package com.ganmiao.server.supplier.mapper;

import com.ganmiao.server.supplier.entity.Supplier;
import org.apache.ibatis.annotations.*;

@Mapper
public interface SupplierMapper {

    @Select("<script>" +
            "select * from suppliers " +
            "<if test='id != null' >" +
            "where id = #{id}" +
            "</if>" +
            "</script>")
    public Supplier suppliersGet(Integer id);

    @Insert("insert into suppliers(id,user_id,supplier_name, contacts, telephone, address)" +
            "values(#{id},#{user_id},#{supplier_name}, #{contacts}, #{telephone}, #{address})")
    public Integer suppliersInsert(Supplier suppliers);

    @Delete("DELETE FROM suppliers WHERE id = #{id}")
    public void suppliersDelete(Integer id);

    @Update("UPDATE suppliers SET user_id = #{user_id}, supplier_name = #{supplier_name}, contacts = #{contacts}, telephone = #{telephone}, address = #{address} WHERE id = #{id}")
    public void suppliersUpdate(Integer id, Integer user_id, String supplier_name, String contacts, String telephone, String address);
}

